package demo_0427.homework1;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

public class T1_0427 {
    /*编写程序，插入25个整数（可以用随机数）到LinkedList对象。对LinkedList对象中的元素排序，求和及平均值。*/
    public static void main(String[] args) {
        List<Integer> list = new LinkedList<>();
        for (int i = 0; i < 25; i++) {
            int num = (int) (Math.random() * 100);
            list.add(num);
        }
        System.out.println(list);
        System.out.println("-------------------");
        Collections.sort(list);
        System.out.println(list);
        System.out.println("--------------------");
        double sum = 0.0;
        for (Integer num : list) {
            sum += num;
        }
        System.out.println(sum / 25);
    }
}
